﻿#include "stdafx.h"
#include "GameCore.h"
#include "GameCoreScriptBinder.h"
#include "GraphicScriptBinder.h"
#include "PhysScriptBinder.h"
#include "ToolScriptBinder.h"
#include "UIScriptBinder.h"
#include "NetBinder.h"

_NAMESPACE_BEGIN

GameCore::GameCore()
{

}

GameCore::~GameCore()
{

}

void GameCore::Initial()
{
//#ifdef _DEBUG
	//日志系统初始化
	Log::CreateInstance();
//#endif

	//脚本绑定
	Core_ScriptBinder::CreateInstance();
	RenderLib_ScriptBinder::CreateInstance();
	Tool_ScriptBinder::CreateInstance();
	PhysicsLib_ScriptBinder::CreateInstance();
	UI_Binder::CreateInstance();
	Net_ScriptBinder::CreateInstance();

	//编译并执行脚本入口程序
	SAVE_LOG("编译脚本");
	NatRacing::AngelScriptBinder::Instance()->CompileMainScript("..\\GameScript\\main.hpp");
	//NatRacing::AngelScriptBinder::Instance()->LoadCompiledScript("","ScriptBin.bin");

	SAVE_LOG("执行脚本主程序");
	NatRacing::AngelScriptBinder::Instance()->RunMainFunc();
}

void GameCore::RegistScriptObj( CONST_REF(std::string) name, asIScriptObject* obj )
{
	scriptObjs[name] = obj;
}

_NAMESPACE_END

